<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
   
    <link rel="stylesheet" href="bootstrap-4.5.3/css/bootstrap.css">
    <link rel="stylesheet" href="css/login.css">
</head>

<body class="text-center">
    <form id="myFormNode" action="index.html" class="form-signin">
        <img class="mb-4" src="images/a.jpg" alt="" width="72" height="72">
        <h1 class="h3 mb-3 font-weight-normal">请登录</h1>
        <div class="form-group row align-items-center ">
            <label class="col-sm-3" for="username">用户名</label>
            <input type="text" name="username" id="username" class="form-control col-sm-9" placeholder="用户名/手机号/邮箱">
        </div>
        <div class="form-group row align-items-center">
            <label class="col-sm-3" for="password">密码</label>
            <input type="password" name="password"  id="password" class="form-control col-sm-9" placeholder="密码" >
        </div>
        <div class="checkbox mb-3">
            <label>
                <input type="checkbox" name="rememberme" value="rememberme">记住我
            </label>
        </div>
        <button class="btn btn-lg btn-primary btn-block" type="submit">登录</button>
        <p class="mt-5 mb-3 text-muted">&copy; 2017-2018</p>
    </form>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/2.2.4/jquery.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
    <script src="./bootstrap-4.5.3/js/bootstrap.js"></script>
    <script src="./utils/tools.js"></script>
    <script>
myFormNode.onsubmit = function(e) {
    e.preventDefault();
    // 收集表单中所有的藏书
    // {}
    var data = transeformParams($(this).serialize())
    console.log(data);
    // 发送ajax请求  
    $.ajax({
        url:obj.baseUrl+"/user?method=login",
        data:data,
        success:function(result) {
           // console.log(result);
            if(result.status == 200) {
                console.log(result.data);
                // 将用户信息保存到浏览器sessionStore
                sessionStorage.setItem("user",JSON.stringify(result.data))
                // 指向跳转的位置
                location.href = "./index.html";
            }else {
                alert(result.msg);
            }
        }
    })
} 


    </script>
</body>





</html>

